import rclpy
from rclpy.node import Node
from arduinobot_msgs.srv import AddTwoints

class SimpleServiceServer(Node):
    def __init__(self):
        super().__init__('simple_service_server')
        self.srv = self.create_service(AddTwoints, 'add_tow_int', self.service_callback)
        self.get_logger().info('Service server is ready to receive requests on "add_two_ints" topic')
    def service_callback(self, request, response):

        self.get_logger().info('Received request: "%d + %d" ' % (request.a , request.b))
        response.sum = request.a + request.b
        return response
    

def main():
    rclpy.init()
    simple_service_server = SimpleServiceServer()
    rclpy.spin(simple_service_server)
    simple_service_server.destroy_node()
    rclpy.shutdown()
if __name__ == '__main__':
    main()
# This code defines a simple ROS 2 service server that listens for requests on the 'chatter' topic.
